<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class CreateTemplateTodoFileTable extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up()
    {

        $this->table('template_todo_file', ['id' => false, 'primary_key' => ['id'], 'engine' => 'InnoDB', 'collation' => 'utf8mb4_general_ci'])
            ->addColumn('id', 'integer', ['identity' => true, 'signed' => false, 'limit' => 11, 'comment' => '自增ID'])
            ->addColumn('template_todo_id', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '项目阶段关联ID'])
            ->addColumn('category', 'string', ['default' => '', 'limit' => 128, 'comment' => '文件分类'])
            ->addColumn('content', 'string', ['default' => '', 'limit' => 128, 'comment' => '文件格式'])
            ->addColumn('created_by', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建者'])
            ->addColumn('created', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->addColumn('updated_by', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建者'])
            ->addColumn('updated', 'integer', ['signed' => false, 'default' => 0, 'limit' => 11, 'comment' => '创建时间'])
            ->create();
    }

    public function down()
    {
        $this->table('template_todo_file')->drop()->save();
    }
}
